package com.bykj.property.api.controller;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import com.alibaba.fastjson.JSON;
import com.bykj.property.controller.vo.export.NewsSendExport;
import com.bykj.property.controller.vo.request.NewsSendPageRequest;
import com.bykj.property.controller.vo.response.RespResult;
import com.bykj.property.model.NewsSend;
import com.bykj.property.service.NewsSendService;
import com.bykj.property.util.ExcelUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 信息推送表 前端控制器
 * </p>
 *
 * @author liangyiming
 * @since 2019-06-20
 */

@Slf4j
@Api(tags = {"api信息推送表"})
@RestController
@RequestMapping("/api")
public class InfomationController {
    @Autowired
    NewsSendService targetService;


    @ApiOperation(value = "查询列表接口")
    @RequestMapping(value = "/infomation", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult query() {
            return RespResult.ok(targetService.list());
    }

    @ApiOperation(value = "查询详情接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query")
    })
    @RequestMapping(value = "/infomation/detail", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public RespResult get(@NotEmpty String id) {
        return RespResult.ok(targetService.getById(id));
    }

}
